
$(document).ready(function() {
    $("#submmit").click(function () {
        var content = CKEDITOR.instances.editor1.getData();
        var title = $("#title")[0].value;
        var author = $("#author")[0].value;
        if (content.length>=10 && title.length>=1 && author.length>=1 && content.length<=1000)
        {
            $.post('edit',
            {
                title:$("#title")[0].value,
                author:$("#author")[0].value,
                content:CKEDITOR.instances.editor1.getData()
            },
            function (data,status) {
                if (status == 'success')
                {
                    Msg = JSON.parse(data)
                    alert(Msg.msg)
                    var page = window.parent.document.getElementById("ifd");
                    page.setAttribute('src','index_content.html')
                }


            });
        }
        else
        {
            alert('字数不满足要求!')
        }

    });
    $('#backforward').click(function () {
        if(confirm('你确定放弃编辑内容返回吗?'))
        {
          var page = window.parent.document.getElementById("ifd");
          page.setAttribute('src','index_content.html')
        }
    });
});